package com.wenshi.common.utils;

import io.netty.channel.Channel;

import java.util.concurrent.ConcurrentHashMap;

public class ChannelMap {
    private static volatile ConcurrentHashMap<String, Channel> channelMap = null;

    private ChannelMap(){

    }
    public static ConcurrentHashMap<String,Channel> getChannelMap() {
        if (null == channelMap) {
            synchronized (ChannelMap.class) {
                if (null == channelMap) {
                    channelMap = new ConcurrentHashMap<>();
                }
            }
        }
        return channelMap;
    }
    public static Channel getChannel(String remoteAddress) {
        return getChannelMap().get(remoteAddress);
    }
}
